<?php

$page_title = "Upgrade Gallery";
$rank_check = 1;
include "header.inc.php";

print "$openHTML";

$find_gallery = fetch("SELECT * FROM usergallerys WHERE owner = '$userid' AND game = '$game'");

if (!$find_gallery[id])
{
	die("You do not have a gallery yet, please click <a href=makegallery.php?game=$game>here</a> to create one.$closeHTML");
}

$max_stock = $find_gallery[gallery_size] * 5;
$cost_2_upgrade = ($find_gallery[gallery_size] * 10) + 10;
$next_level = $find_gallery[gallery_size] + 1;

$findTokens = fetch("SELECT * FROM upgrade_tokens WHERE user = '$userid' AND game = '$game' AND upgrade = 'gallery'");
if (!$findTokens[ammount]) { $findTokens[ammount] = 0; }

ECHO <<<END

<p align=center><a href=mygallery.php?game=$game>My Stock</a> | <a href=edit_gallery.php?game=$game>Edit gallery</a> | <a href=usergallery.php?game=$game&user=$username>View gallery</a> | <a href=upgrade_gallery.php?game=$game>Upgrade gallery</a></p>

<P><FORM ACTION="upgrade_gallery.pro.php?game=$game&next_upgrade=$next_level" METHOD=POST>
   <CENTER><BR>
   <TABLE BGCOLOR="$tableOutline" CELLSPACING=1 CELLPADDING=0 WIDTH=450>
      <TR BGCOLOR="$topAndBottomBG">
         <TD>
            <CENTER class=white><FONT SIZE="+2" COLOR="$topAndBottomText"><B>--Upgrade
            Your Gallery--</B></FONT></CENTER>
         </TD>
      </TR>
      <TR BGCOLOR="$maincellColor">
         <TD>
            <CENTER>Your gallery is currently size <B>$find_gallery[gallery_size]</B> which means
            it can hold <B>$max_stock</B> items</CENTER>
         </TD>
      </TR>
      <TR BGCOLOR="$reallyLight">
         <TD>
            <CENTER>It will cost <B>$cost_2_upgrade $pointsVar</B> to upgrade your gallery! <INPUT TYPE=submit NAME=upgrade VALUE="Upgrade to size $next_level"></FORM></CENTER>
         </TD>
      </TR>
      <TR BGCOLOR="#FFFFFF">
         <TD>
            <FORM ACTION="upgrade_gallery.pro.php?game=$game&next_upgrade=$next_level&use_token=true" METHOD=POST><CENTER><a href=upgrade_tokens.php?game=$game>Upgrade Tokens</a>: $findTokens[ammount] <input type=submit value="Use Token!"></CENTER></form>
         </TD>
      </TR>
   </TABLE>
   </CENTER>
</P>

END;

print "$closeHTML";
?>